package org.tony.spider.novel.common;

import java.util.concurrent.ConcurrentHashMap;

import org.tony.spider.common.AbstractContext;
import org.tony.spider.novel.entries.FromSite;

public class SitesContext extends AbstractContext<String, FromSite>
{

  private static SitesContext instance;

  private SitesContext()
  {
    this.context = new ConcurrentHashMap<String, FromSite>();
    //TODO read data from from-sites.xml
    FromSite zhulang = new FromSite("zhulang", new String[] { "div.bookdetail", "a[href]" });
    put("qidian", new FromSite("qidian"));
    put("zhulang", zhulang);
  }

  public static synchronized SitesContext getInstance()
  {
    if (instance == null)
    {
      instance = new SitesContext();
    }
    return instance;
  }
}
